\typeout{Document Style `buptqmul' <10 Dec 08>.}

% The Undergraduate paper template for students in 
% Joint Programme of BUPT and QMUL.
%
% Copyright (c) 2008 DENG Nan
%
% Acknowledgement:
% Thanks Dr. Christopher Harte for his suggestions.
% And ZHU Huanzhou who provided the cover template
% of his undergraduate paper
%

\NeedsTeXFormat{LaTeX2e}[1995/12/01]
\ProvidesClass{buptqmul}[2008/12/10 v0.1 Paper class]

\PassOptionsToClass{a4paper,12pt}{report}
\LoadClassWithOptions{report}

\usepackage{CJK}
\usepackage{setspace}
\usepackage{graphicx}
\usepackage{url}
\usepackage[dvipdfm]{hyperref}
\usepackage{setspace}
\usepackage{longtable}
\usepackage{fancyhdr}
\usepackage{tabularx}
\usepackage{amsmath}
\usepackage[top=0.5in, left=1.2in, right=1.1in, bottom=1in]{geometry}
%\usepackage[top=1in,bottom=1in,left=1.25in,right=1.25in]{geometry}
\usepackage{SIunits}

%\def\jpprojectname#1{\def\thejpprojectname{#1}}
%\def\jpstudentname#1{\def\thejpstudentname{#1}}
%\def\jpstudentnumber#1{\def\thejpstudentnumber{#1}}
%\def\jpsupervisor#1{\def\thejpsupervisor{#1}}
%\def\jpprogram#1{\def\thejpprogram{#1}}
%\def\jpprogramme#1{\def\thejpprogram{#1}}
%\def\jpclassnumber#1{\def\thejpclassnumber{#1}}
%\def\jpdate#1{\def\thejpdate{#1}}
%\def\jpclassnumber#1{\def\thejpclassnumber{#1}}


\def\projectname#1{\def\thejpprojectname{#1}}
\def\studentname#1{\def\thejpstudentname{#1}}
\def\studentnumber#1{\def\thejpstudentnumber{#1}}
\def\supervisor#1{\def\thejpsupervisor{#1}}
\def\programname#1{\def\thejpprogram{#1}}
\def\programmename#1{\def\thejpprogram{#1}}
\def\classnumber#1{\def\thejpclassnumber{#1}}
\def\paperdate#1{\def\thejpdate{#1}}
\def\classnumber#1{\def\thejpclassnumber{#1}}
\def\reportname#1{\def\thejpreportname{#1}}

%\def\jpsecondaryprojectname#1{\def\thejpsecondaryprojectname{#1}}
\def\secondaryprojectname#1{\def\thejpsecondaryprojectname{#1}}

\def\papertitle{%
\topmargin=-0.5in
\begin{titlepage}

\pagestyle{empty} % without page number

\begin{center}
\begin{figure}
 \includegraphics[scale=0.6]{logo}
\end{figure}
\par
\end{center}

\begin{center}

\ifdefined\thejpprojectname
\vspace{0.6in}

\ifdefined\thejpreportname
{\LARGE \thejpreportname}
\else
{\LARGE Undergraduate Project Report}
\fi % \ifdefined\thejpreportname

\vspace{2in}
{\LARGE \textbf{\thejpprojectname}}\\
\par
% if this project has a secondary name
\ifdefined\thejpsecondaryprojectname
\vspace{0.2in}
\hfill \textbf{\thejpsecondaryprojectname}
\par
\vspace{1.9in}
\else
\vspace{2.1in}
\fi % \ifdefined\thejpsecondaryprojectname

\else
\vspace{2.3in}
\ifdefined\thejpreportname
{\LARGE {\bf \thejpreportname}}\\
\else
{\LARGE {\bf The Lab Report}}\\
\fi % \ifdefined\thejpreportname
\ifdefined\thejpsecondaryprojectname
\vspace{0.2in}
\hfill \textbf{\thejpsecondaryprojectname}
\par
\vspace{2.6in}
\else
\vspace{2.8in}
\fi 

\fi % \ifdefined\thejpprojectname

% comes with student and supervisor info

\ifdefined\thejpdate
{}
\else
{\def\thejpdate{\today}}
\fi

\ifdefined\thejpdate
\else \def\thejpdate{\today}
\fi

\begin{tabular}{rl}
{\large \textbf{Name:}}&{\large \thejpstudentname}\\
{\large \textbf{Programme:}}&{\large \thejpprogram}\\
{\large \textbf{Class:}}&{\large \thejpclassnumber}\\
{\large \textbf{Student Number:}}&{\large \thejpstudentnumber}\\
\ifdefined\thejpsupervisor
{\large \textbf{Supervisor:}}&{\large \thejpsupervisor}\\
\fi
\end{tabular}

\vspace{0.3in}

\ifdefined\thejpdate
{\large \textbf{\thejpdate}}
\else
{\large \textbf{\today}}
\fi

\end{center}
\end{titlepage}
\pagestyle{plain}
}
\def\undergraduatepapersetting{
%\setstretch{2} 
\renewcommand{\baselinestretch}{1.24} % TODO 1.5 line spacing ?? 
\parskip=12pt % 12pt space before each paragraph
\renewcommand{\thepage}{\roman{page}}
}

\def\disclaimerpage{
\begin{center} 
{\bf {\large DISCLAIMER}}
\end{center}

This report is submitted as part requirement for the degree of BSc(Eng) in title\footnote{{\LARGE which title??}} at the University of London, and Beijing University of Posts and Telecommunication. It is the product of my own labour except where indicated in the text. The report may be freely copied and distributed provided the source is acknowledged
\newpage
}

\def\tableofpapercontents{
\tableofcontents
\renewcommand{\thepage}{\arabic{page}}
\pagestyle{plain}
\newpage}

\def\proposalform{{\LARGE {\bf TODO} the proposal form} \newpage}

% new environments
%\begin{CJK}{UTF8}{nsung}
%\newenvironment{jpChineseabs}{\begin{CJK}{UTF8}{nsung} 摘要\\}{\end{CJK} \newpage}

\newenvironment{zhabstract}{\begin{CJK}{UTF8}{nsung} \begin{center}
 {\large {\bf 摘要}}
\end{center}}{\end{CJK} \newpage}

\newenvironment{enabstract}{\begin{center}
 {\large {\bf Abstract}}
\end{center}}
{\newpage}

\newenvironment{chapters}{
\renewcommand{\thepage}{\arabic{page}}
\pagestyle{plain}}
{\renewcommand{\thepage}{\arabic{page}}}
%\end{CJK}